package com.dragon.modules.yuegou.model;

import com.dragon.modules.yuegou.enums.OwnerType;

import javax.annotation.Nullable;

public class Owner {

	private final OwnerType ownerType;

	private final String groupId;

	private final String busdId;

	private final String merchantId;

	public Owner(OwnerType ownerType, @Nullable String groupId, @Nullable String busdId, @Nullable String merchantId) {
		super();
		this.ownerType = ownerType;
		this.groupId = groupId;
		this.busdId = busdId;
		this.merchantId = merchantId;
	}

	public OwnerType getOwnerType() {
		return ownerType;
	}

	public String getGroupId() {
		return groupId;
	}

	public String getBusdId() {
		return busdId;
	}

	public String getMerchantId() {
		return merchantId;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((busdId == null) ? 0 : busdId.hashCode());
		result = prime * result + ((groupId == null) ? 0 : groupId.hashCode());
		result = prime * result + ((merchantId == null) ? 0 : merchantId.hashCode());
		result = prime * result + ((ownerType == null) ? 0 : ownerType.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Owner other = (Owner) obj;
		if (busdId == null) {
			if (other.busdId != null) {
				return false;
			}
		} else if (!busdId.equals(other.busdId)) {
			return false;
		}
		if (groupId == null) {
			if (other.groupId != null) {
				return false;
			}
		} else if (!groupId.equals(other.groupId)) {
			return false;
		}
		if (merchantId == null) {
			if (other.merchantId != null) {
				return false;
			}
		} else if (!merchantId.equals(other.merchantId)) {
			return false;
		}
		return ownerType == other.ownerType;
	}

}
